#ifndef ACCEPTED_FLOW_INCLUDED
#define ACCEPTED_FLOW_INCLUDED

#include <iostream>
#include <boost/smart_ptr/shared_ptr.hpp>
#include <map>
#include <queue>


#include "udp_sender.h"
#include "frame.h"
#include "thread.h"


class AcceptedFlow : public ThreadProcess
{
	struct FlowClean
	{
		FlowID flowID;
		time_t time;
	};

	typedef std::map<FlowID /*flowID*/, UDPSenderPointer> FlowIDvsFilterID;
	typedef std::queue<FlowClean> FlowIDCleanList;

public:
	AcceptedFlow();
	UDPSenderPointer find(FlowID const& flowID);
	void clean(FlowID const& flowID);
	void add(FlowID const& flowID, UDPSenderPointer& filterID);
	bool isClean();
	bool process();
private:
	FlowIDvsFilterID m_accepted;
	FlowIDCleanList m_usedList;
	pthread_mutex_t m_lock;
};
#endif
